<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        //设置页面加载事件
        window.onload = function () {
            var testId = document.getElementById("testId");
            /*testId.onblur = function () {
                alert("失去焦点事件");
            };*/
            /*testId.onfocus = function () {
                alert("获得焦点事件");
            };*/
            testId.onchange = function () {
                alert("内容改变事件");
            };
        };
    </script>
</head>
<body>

<input type="text" id="testId">

</body>
</html>